


const {MYSQL}  = require("../../../../../../../../ruoling-common/src/com/ruoling/common/config/mysqlconfig.js");

module.exports = class CommonService{


    /**
     * 单个删除Service
     * @param table
     * @param Id_all
     * @param callback
     * @returns {Promise<void>}
     * @constructor
     */
    static async Common_Delete_All(table,Id_all,callback){

        let startTrans = null;
        try{
            let connect = await MYSQL().connect();
            startTrans  = await connect.startTrans();
            let row = await startTrans.query("update "+table+" SET Is_delete = 0 where ID = "+Id_all+"")
            await startTrans.commit();
            callback(null,row.affectedRows);
            return;
        }catch (e) {
            await startTrans.rollback();
            callback(e);
            return;
        }
    }
}